<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>字符串形式的refs</title>
</head>
<body>
     <!-- 引入React核心库 -->
     <script src="../JS/react.development.js"></script>
     <!-- 引入ReactDOM，用于支持react操作DOM -->
     <script src="../JS/react-dom.development.js"></script>
     <!-- 引入babel 用于将书写的JSX语法 编译成JS语法 -->
     <script src="../JS/babel.min.js"></script>

    <div id="test"></div>

    <script type="text/babel">
        class Demo extends React.Component{
            showData =()=>{
                const {input1} = this.refs
                alert(input1.value)
            }
            render(){
                return(
                    <div>
                        <input ref="input1" type="text" placeholder="点击按钮提示数据"/>
                        <button onClick={this.showData} style={{border:'1px red solid',height:'20px',color:'aqua'}}>点我显示左侧的数据</button>    
                        <input type="text" placeholder="失去焦点提示数据"/>
                    </div>
                )
            }
        }
        ReactDOM.render(<Demo />,document.getElementById('test'))


        /* 
            最老的 快废弃了
            过时api
        */



    </script>







</body>
</html>